import java.io.*;
import java.net.Socket;

public class Output extends Thread {
	private Socket socket;
	private String string;
	private IRCClient client;

	public Output(Socket socket, IRCClient client) {
		this.client = client;
		this.socket = socket;
	}

	public void run() {
		while (true) {
			string = "";
			try {
				BufferedReader in = new BufferedReader(new InputStreamReader(
						System.in));
				OutputStream out = socket.getOutputStream();
				while (string != null) {
					string = in.readLine();
					string = string + '\n';
					out.write(string.getBytes());
					out.flush();
				}
			} catch (Exception e) {
				//e.printStackTrace();
			}
		}
	}
	
	public void send(String s) {
		OutputStream out;
		try {
			out = socket.getOutputStream();
			out.write(s.getBytes());
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
}
